package com.lagou.firstStageThirdModel.Fourth;

/**
 * 学生类
 */
public class Student {

    private int number;
    private String name;
    private int age;

    public Student() {
    }

    public Student(int number, String name, int age) {
        setNumber(number);
        setName(name);
        setAge(age);
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age <= 0) {
            System.out.println("年龄数值不合理");
        } else {
            this.age = age;
        }
    }

    @Override
    public String toString() {
        return "Student{学号：" + number + ", 姓名：'" + name + ", 年龄:" + age + '}';
    }
}
